package com.ethink.warehouse.facade.impl;

import com.ethink.warehouse.api.request.WarehouseStatusSetRequest;
import com.ethink.warehouse.api.response.*;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ethink.warehouse.api.WarehouseFacade;
import com.ethink.warehouse.api.info.WarehouseInfo;
import com.ethink.warehouse.api.request.WarehouseAddRequest;
import com.ethink.warehouse.api.request.WarehouseQueryRequest;
import com.ethink.warehouse.api.request.WarehouseUpdateRequest;
import com.ethink.warehouse.service.WarehouseService;
import java.util.List;

/**
 * 仓库主仓 Facade接口实现
 *
 * @author default
 * @date 2022-11-01
 */
@RestController
@Slf4j
@RequestMapping("warehouse-service/facade/v1/warehouse")
public class WarehouseFacadeImpl implements WarehouseFacade {

    @Autowired
    private WarehouseService warehouseService;

    @Override
    public Page<WarehouseInfo> queryWarehouse(WarehouseQueryRequest request) {
        return warehouseService.queryWarehouse(request);
    }

    @Override
    public WarehouseDetailsResponse getWarehouseById(Long warehouseId) {
        return warehouseService.getWarehouseById(warehouseId);
    }

    @Override
    public List<WarehouseInfo> listWarehouse() {
        return warehouseService.listWarehouse();
    }

    @Override
    public WarehouseAddResponse addWarehouse(WarehouseAddRequest request) {
        return warehouseService.addWarehouse(request);
    }

    @Override
    public void updateWarehouse(WarehouseUpdateRequest request) {
        warehouseService.updateWarehouse(request);
    }

    @Override
    public void setWarehouseStatus(WarehouseStatusSetRequest request) {
        warehouseService.setWarehouseStatus(request);
    }

}